<?php
// include function files for this application
require_once('/home/domains/uny-con.com/public_html/uny-con_fns.php');
if (!session_id()) { session_start(); }

//get some variables
if (isset($_SESSION['current_attendee_id']))
	$current_attendee_id = $_SESSION['current_attendee_id'];
if (isset($_POST['reg_item'])) $reg_item = $_POST['reg_item'];

//This is an admin only script so first lets check to make sure the user is valid and an admin. then we can do toher stuff.

if (!check_valid_user() || ($_SESSION['admin'] != 't')) {
	do_html_header('Unauthorized access', staysmall, $uny);
	echo 'You are not logged in or are not authorized to view this page. Please move along.';
	print_brs(6);
	do_html_footer(news);
	exit;
	}

if (!isset($current_attendee_id ) || empty($current_attendee_id)) {
	do_html_header('Unauthorized access', staysmall, $uny);
	echo 'I do not know what user you want to sign up for events as. Please return to the the attendee\'s info page and try again.';
	print_brs(6);
	do_html_footer(news);
	exit;
	}
	
	foreach($reg_item as $reg_string) {
		if (!empty($reg_string)) {
			list($reg_attendee_id,$timeslot,$event_id) = explode(".", $reg_string);
//			echo "add_event_reg($event_id, $timeslot, $reg_attendee_id)";
			$addsql = add_event_reg($event_id, $timeslot, $reg_attendee_id);
			}
		}
	header("Location: ".$conf['base_path']."registration/attendee_home.php");
	exit;
